package com.example.demo.config.cos;

import com.qiniu.util.Auth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author :xie
 * Email: 1487471733@qq.com
 * Date: 2018/2/8
 * Time: 22:57
 * Describe:
 */
@Configuration
@EnableConfigurationProperties(qiniuCosConfigProperties.class)
public class qiniuConfig {

    @Autowired
    private qiniuCosConfigProperties qiniuCosConfigProperties;

    @Bean
    public Auth auth(){

        Auth auth=Auth.create(qiniuCosConfigProperties.getAccessKey(),qiniuCosConfigProperties.getSecretKey());
        //auth.uploadToken(qiniuCosConfigProperties.getBucket());

        return auth;
    }
}
